<div ng-include src="'tpl/public/header.html'"></div> 
<div class="contents">
  <ol class="breadcrumb" ng-if="false">
    <li><a href="#/index/panel">首页</a></li>
    <li><a href="#/product/list">产品列表</a></li>
    <li><a href="#/product/view?id={{project.id}}">{{project.pName}}</a></li>
    <li class="active">年化率及返佣</li>
  </ol>
  <div class="row">
    <div class="col-xs-7">
    <table class="table table-striped table-hover ">
      <thead>
        <tr>
          <th width="60">起始金额</th>
          <th width="60">结束金额</th>
          <th width="80">预期年化率</th>
      <!--    <th width="80" ng-if="project.target == '1'">核心价</th>
          <th width="80" ng-if="project.target == '1'">后端核心价</th>
          -->
          <th width="80" ng-if="packPrice.packPriceFlag">打包价</th>
       <!--   <th width="80">后端成本价</th>   -->
          <th width="80">机构前端价</th>
          <th width="80">机构后端价</th>
          <th width="80">挂网前端价</th>
          <th width="80">挂网后端价</th>
         <!-- <th width="80">竞争价</th>  -->
          <th width="130">操作</th>

        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="revenue in projectAnnualRevenue" ng-click="edit($index)">
          <td>{{revenue.pStartAmount | moneyRender}}</td>
          <td>{{revenue.pEndAmount | moneyRender}}</td>
          <td>{{revenue.pAnnualRevenueExpect }}</td> 
          <!--
          <td ng-if="project.target == '1'">{{projectRabateList[$index].pCorePrice | profitRender}}</td> 
          <td ng-if="project.target == '1'"> 
              {{projectRabateList[$index].pCoreBackPrice| profitRender}}</td> 
          
-->
          <td ng-if="packPrice.packPriceFlag">{{projectRabateList[$index].pCostPrice | profitRender}}</td>
<!--      <td>{{projectRabateList[$index].pCostBackPrice| profitRender}}</td>
-->
          <td>{{projectRabateList[$index].pSellingPrice | profitRender}}</td> 
          <td>{{projectRabateList[$index].pBackSellingPrice| profitRender}}</td>
          <td>{{projectRabateList[$index].pRabateProfit | profitRender}}</td> 
          <td>{{projectRabateList[$index].pBackRabateProfit| profitRender}}</td>
      <!--    <td>{{projectRabateList[$index].pRebateAmount| profitRender}}</td>   -->
          <td class="optd">
            <a class="cur-p" ng-click="edit($index)" has-auth where="btn" who="PRODUCT_PROFIT_UPDATE" ng-if="!packPrice.packPriceFlag"  owner="{{project.createBy}}">编辑</a>

           <a class="cur-p" ng-click="edit($index)"  ng-if="packPrice.packPriceFlag" >编辑</a>
             
            <a class="cur-p" ng-click="deleteItem($index)" has-auth where="btn" who="PRODUCT_PROFIT_UPDATE" owner="{{project.createBy}}">删除</a>
          </td>
        </tr>
      </tbody>
    </table>
    <span style="font-size: 16px;color: red;">价格变更记录:</span>
    <table class="table table-striped table-hover ">
      <thead>
        <tr>
          <th width="60">操作人</th>
          <th width="200">操作时间</th>
          <th width="80">起始金额</th>
          <th width="80">结束金额</th>
          <th width="80">预期年化率</th>
          <th width="80" ng-if="packPrice.packPriceFlag">打包价</th> 
      <!--    <th width="80">后端成本价</th>   -->
          <th width="80">机构前端价</th>
          <th width="80">机构后端价</th>
          <th width="80">挂网前端价</th>
          <th width="80">挂网后端价</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="log in logList.slice().reverse()">
          <td>{{log.annualRevenue.createBy}}</td>
          <td>{{log.annualRevenue.createDate | date:'yyyy-MM-dd HH:mm:ss'}}</td>
          <td>{{log.annualRevenue.pstartAmount | moneyRender}}</td>
          <td>{{log.annualRevenue.pendAmount | moneyRender}}</td>
          <td>
            <span style="color:red" ng-if="log.oldpAnnualRevenueExpect!=log.annualRevenue.pannualRevenueExpect">{{log.annualRevenue.pannualRevenueExpect }}</span>
           <span ng-if="log.oldpAnnualRevenueExpect==log.annualRevenue.pannualRevenueExpect">{{log.annualRevenue.pannualRevenueExpect }}</span>
          </td> 
         <td ng-if="packPrice.packPriceFlag">
          <span style="color:red" ng-if="log.oldpCostPrice!=log.pCostPrice">{{log.pCostPrice | profitRender}}</span>
            <span ng-if="log.oldpCostPrice==log.pCostPrice">{{log.pCostPrice | profitRender}}</span>
         </td>  
       <!--   <td>{{log.pCostBackPrice| profitRender}}</td>    -->
          <td>
            <span style="color:red" ng-if="log.oldpSellingPrice!=log.pSellingPrice">{{log.pSellingPrice | profitRender}}</span>
            <span ng-if="log.oldpSellingPrice==log.pSellingPrice">{{log.pSellingPrice | profitRender}}</span>
          </td> 
          <td>
          <span style="color:red" ng-if="log.oldpBackSellingPrice!=log.pBackSellingPrice">{{log.pBackSellingPrice| profitRender}}</span>
          <span ng-if="log.oldpBackSellingPrice==log.pBackSellingPrice">{{log.pBackSellingPrice| profitRender}}</span>
          </td>
          <td>
            <span style="color:red" ng-if="log.oldpRabateProfit!=log.pRabateProfit">{{log.pRabateProfit | profitRender}}</span>
            <span ng-if="log.oldpRabateProfit==log.pRabateProfit">{{log.pRabateProfit | profitRender}}</span>
          </td> 
          <td>
            <span style="color:red" ng-if="log.oldpBackRabateProfit!=log.pBackRabateProfit">{{log.pBackRabateProfit| profitRender}}</span>
            <span ng-if="log.oldpBackRabateProfit==log.pBackRabateProfit">{{log.pBackRabateProfit| profitRender}}</span>
          </td>  
        </tr>
      </tbody>
    </table>
    </div>
    <form class="form-horizontal col-xs-5" role="form" name="form" ng-submit="save()" novalidate has-auth where="btn" who="PRODUCT_PROFIT_UPDATE" > 

      <div class="form-group">
        <label for="advertTitleInput" class="col-sm-2 control-label">产品名称</label>
        <div class="col-sm-6 form-control-text">{{project.pName}}</div>
      </div>
      <div class="form-group" ng-class="{'has-error':form.pStartAmount.$invalid}">
        <label for="advertTitleInput" class="col-sm-2 control-label">起始金额(万元)</label>
        <div class="col-sm-6">
          <input type="number" class="form-control" id="advertTitleInput" placeholder="起始金额" name="pStartAmount" ng-model="item.pStartAmount" required="required">
        </div>
      </div>
      <div class="form-group" ng-class="{'has-error':form.pEndAmount.$invalid }">
        <label for="advertLinkInput" class="col-sm-2 control-label">结束金额(万元)</label>
        <div class="col-sm-6">
          <input type="number" class="form-control" id="advertLinkInput" placeholder="结束金额,不填写时为募集金额" name="pEndAmount" ng-model="item.pEndAmount" >
        </div>
      </div>
 <!--     <div class="form-group" ng-show="project.pType=='06'" ng-class="{'has-error':form.pAnnualRevenueExpect.$invalid}">
        <label for="" class="col-sm-2 control-label">预期年化率(需要加%)</label>
        <div class="col-sm-5">
          <input type="text" class="form-control" placeholder="结尾需要加%" name="pAnnualRevenueExpect" ng-model="item.pAnnualRevenueExpect" required="required">
        </div>
      </div>  -->
      <div class="form-group"  ng-class="{'has-error':form.pAnnualRevenueExpect.$invalid}">
        <label for="" class="col-sm-2 control-label">预期年化率</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" placeholder="必须输入%" name="pAnnualRevenueExpect" ng-model="item.pAnnualRevenueExpect" required="required">
        </div>
      </div> 
      <div class="form-group" ng-class="{'has-error':form.pIsAgreement.$invalid}">
        <label class="col-sm-2 control-label">是否协议</label>
        <div class="col-sm-5">
          <label class="radio-inline">
            <input type="radio" name="status" value="1" ng-model="item.pIsAgreement">是
          </label>
          <label class="radio-inline">
            <input type="radio" name="status" value="0" checked="true" ng-model="item.pIsAgreement" />否
          </label>
        </div>
      </div> 

      <div class="form-group"  ng-if="false&&item.pIsAgreement != '1'">
        <label for="" class="col-sm-2 control-label">核心价</label>
        <div class="col-sm-3">
          <input type="number" class="form-control" id="" placeholder="核心价" value="10" name="pCorePrice"  ng-model="item.pCorePrice" required="required">
        </div>
        <div class="col-sm-3">
          <input type="number" class="form-control" id="" placeholder="后端" value="10" name="pCoreBackPrice" ng-model="item.pCoreBackPrice" >
        </div>
      </div> 

      <div class="form-group" ng-if="packPrice.packPriceFlag&&item.pIsAgreement != '1'" ng-class="{'has-error':form.pCostPrice.$invalid }">
        <label for="" class="col-sm-2 control-label">打包价</label>
        <div class="col-sm-3">
          <input type="number" class="form-control" id="" placeholder="打包价" value="10" name="pCostPrice" ng-model="item.pCostPrice" required="required">
        </div>
      </div> 
      <!-- 后端不显示  没了-->
      <div class="col-sm-3" ng-if="false">
          <input type="number" class="form-control" id="" placeholder="后端" value="10" name="pCostBackPrice" ng-model="item.pCostBackPrice" >
        </div>
      <div class="form-group" ng-if="!packPrice.packPriceFlag&&item.pIsAgreement != '1'" ng-class="{'has-error':form.pSellingPrice.$invalid }">
        <label for="" class="col-sm-2 control-label">机构价</label>
        <div class="col-sm-3">
          <input type="number" class="form-control" id="" placeholder="机构价" value="10" name="pSellingPrice" ng-model="item.pSellingPrice" required="required">
        </div>
        <div class="col-sm-3">
          <input type="number" class="form-control" id="" placeholder="后端" value="10" name="pBackSellingPrice" ng-model="item.pBackSellingPrice" >
        </div>
      </div> 
      <div class="form-group" ng-if="!packPrice.packPriceFlag&&item.pIsAgreement != '1'" ng-class="{'has-error':form.pRabateProfit.$invalid }">
        <label for="" class="col-sm-2 control-label">挂网价</label>
        <div class="col-sm-3">
          <input type="number" class="form-control" id="" placeholder="挂网价" value="10" name="pRabateProfit" ng-model="item.pRabateProfit" required="required">
        </div>
        <div class="col-sm-3">
          <input type="number" class="form-control" id="" placeholder="后端" value="10" name="pBackRabateProfit" ng-model="item.pBackRabateProfit" >
        </div>
      </div> 
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-5">
          <button type="submit" ng-if="!packPrice.packPriceFlag" owner="{{project.createBy}}" has-auth where="btn" who="PRODUCT_PROFIT_UPDATE" class="btn btn-default">提交</button>
           <button type="submit" ng-if="packPrice.packPriceFlag" class="btn btn-default">提交</button>
        </div>
      </div>
    </form>
  </div>

	<div class="pager-box" ng-include src="'tpl/public/pager.html'" ng-show="ads.length > 0"></div>
</div>

